import { basicSetup, EditorView } from 'codemirror'
import { javascript } from '@codemirror/lang-javascript'
import { oneDark } from '@codemirror/theme-one-dark'

/**
 * @description: 
 * @param {*} element
 * @param {*} doc
 * @return {*}
 */
export default function CodeEditor(element, doc) {
  return new EditorView({
    doc,
    parent: element,
    extensions: [basicSetup, javascript(), oneDark],
  })
}